%% load
% dbname = 'LFW';
% MatFileName = 'DeepID-{Scale=1}-{Layer=deepid_1}-ImResize.mat';

% dbname = c;
% MatFileName = 'VGG-{Scale=1}-{Layer=fc7}.mat';
% 
% load(fullfile(mycaffe.path, dbname, MatFileName));

%% produce
bSave = false;

bImResize = false;
% bImResize = true;

% network = 'DeepID';
% network = 'VGG';
% network = 'LCNN';
% network = 'LightenedCNN';
% network = 'LightenedCNN-B';
network = 'happynear';

dbname = 'LFW';

% dbname = 'LFW6';
% dbname = 'LFW6-cropped';
% dbname = 'LFW6-cropped-gray';

% dbname = 'AR'

% Features = mycaffe.produceFeatures(dbname, network, bImResize, bSave);

switch network
    case 'DeepID'
        load(fullfile(LFW.dbpath, 'Features-DeepID.mat'))
    case 'happynear'
        load(fullfile(LFW.dbpath, 'Features-happynear.mat'))
    case 'VGG'
        load(fullfile(LFW.dbpath, 'Features-VGG.mat'))
    case {'LightenedCNN', 'LightenedCNN-A'}
        load(fullfile(LFW.dbpath, 'Features-LightenedCNN-A.mat'))
    case 'LightenedCNN-B'
        load(fullfile(LFW.dbpath, 'Features-LightenedCNN-B.mat'))
end

%%
fprintf('Loading image pairs ...\n');
load(fullfile(LFW.dbpath, 'LFWPairs.mat'))
% load(fullfile(LFW.dbpath, 'ImgPairs.mat'))
fprintf('Done!\n');

ImgPairs = [same_pairs; diff_pairs];

%%
Features1 = Features(:, ImgPairs(:, 1));
Features2 = Features(:, ImgPairs(:, 2));
fprintf('Done!\n');

%%
mycaffe.validateByCosine
% mycaffe.validateByL2
